#include<iostream>
#include<cstdlib>
#include<cstring>
using namespace std;
bool GetWord(const char *str,char *word)
{
	static const char *p;
	int i;
	if(str)
	p = str;
	for(i = 0; !isalpha(p[i]) && p[i]; ++i);
	if(p[i] == 0)
	return false;
	p += i;
	for(i = 0; isalpha(p[i]) && p[i]; ++i);
	strncpy(word,p,i);
	word[i] = 0;
	p += i;
	return true;
}
int main()
{
	char *sentence = "To be or not to be,is a problem.";
	char word[100];
	bool b = GetWord(sentence,word);
	while(b){
		cout<<word<<endl;
		b = GetWord(NULL,word);
	}
}